package cn.edu.scau.cmi.ChenKaihui.composite.consistent;

import java.util.ArrayList;
import java.util.List;

public class ConsistentComposite extends ConsistentComponent{
	
	//用于存放员工
	List<ConsistentComponent> subordinates = new ArrayList<ConsistentComponent>();
	
	public ConsistentComposite(String name){
		this.name = name;
	}

	@Override
	void addChild(ConsistentComponent con) {
		subordinates.add(con);
		System.out.println("成功添加下级员工: " + con.getName());
	}

	@Override
	void delete(ConsistentComponent con) {
		subordinates.remove(con);
		System.out.println("成功删除下级员工: " + con.getName());
	}
	
	@Override
	String showMessage() {
		return ("Employee :[ Name : "+ name +" ]");
	}

}
